#include "ImpCheck2.h"

ImpCheck2::ImpCheck2(wxWindow* parent):Impedance(parent)
{
#ifdef HAVE_GTEC_USB_LIBRARY
	hinstLib = LoadLibrary(_("gUSBamp.dll"));
	if (hinstLib != NULL)
	{
		hGT_OpenDevice			=(LibGT_OpenDevice)			GetProcAddress(hinstLib, "GT_OpenDevice");
		hGT_OpenDeviceEx		=(LibGT_OpenDeviceEx)		GetProcAddress(hinstLib, "GT_OpenDeviceEx");
		hGT_CloseDevice			=(LibGT_CloseDevice)		GetProcAddress(hinstLib, "GT_CloseDevice");
		hGT_GetData				=(LibGT_GetData)			GetProcAddress(hinstLib, "GT_GetData");
		hGT_SetBufferSize		=(LibGT_SetBufferSize)		GetProcAddress(hinstLib, "GT_SetBufferSize");
		hGT_SetSampleRate		=(LibGT_SetSampleRate)		GetProcAddress(hinstLib, "GT_SetSampleRate");
		hGT_Start				=(LibGT_Start)				GetProcAddress(hinstLib, "GT_Start");
		hGT_Stop				=(LibGT_Stop)				GetProcAddress(hinstLib, "GT_Stop");
		hGT_SetChannels			=(LibGT_SetChannels)		GetProcAddress(hinstLib, "GT_SetChannels");
		hGT_ResetTransfer		=(LibGT_ResetTransfer)		GetProcAddress(hinstLib, "GT_ResetTransfer");

		hGT_SetDigitalOut		=(LibGT_SetDigitalOut)		GetProcAddress(hinstLib, "GT_SetDigitalOut");
		hGT_SetDigitalOutEx		=(LibGT_SetDigitalOutEx)	GetProcAddress(hinstLib, "GT_SetDigitalOutEx");
		hGT_GetDigitalIO		=(LibGT_GetDigitalIO)		GetProcAddress(hinstLib, "GT_GetDigitalIO");
		hGT_GetDigitalOut		=(LibGT_GetDigitalOut)		GetProcAddress(hinstLib, "GT_GetDigitalOut");
		hGT_EnableTriggerLine	=(LibGT_EnableTriggerLine)	GetProcAddress(hinstLib, "GT_EnableTriggerLine");

		hGT_GetFilterSpec		=(LibGT_GetFilterSpec)		GetProcAddress(hinstLib, "GT_GetFilterSpec");
		hGT_GetNumberOfFilter	=(LibGT_GetNumberOfFilter)	GetProcAddress(hinstLib, "GT_GetNumberOfFilter");
		hGT_SetBandPass			=(LibGT_SetBandPass)		GetProcAddress(hinstLib, "GT_SetBandPass");
		hGT_GetNotchSpec		=(LibGT_GetNotchSpec)		GetProcAddress(hinstLib, "GT_GetNotchSpec");
		hGT_GetNumberOfNotch	=(LibGT_GetNumberOfNotch)	GetProcAddress(hinstLib, "GT_GetNumberOfNotch");
		hGT_SetNotch			=(LibGT_SetNotch)			GetProcAddress(hinstLib, "GT_SetNotch");

		hGT_SetMode				=(LibGT_SetMode)			GetProcAddress(hinstLib, "GT_SetMode");
		hGT_GetMode				=(LibGT_GetMode)			GetProcAddress(hinstLib, "GT_GetMode");
		hGT_SetGround			=(LibGT_SetGround)			GetProcAddress(hinstLib, "GT_SetGround");
		hGT_GetGround			=(LibGT_GetGround)			GetProcAddress(hinstLib, "GT_GetGround");
		hGT_SetReference		=(LibGT_SetReference)		GetProcAddress(hinstLib, "GT_SetReference");
		hGT_GetReference		=(LibGT_GetReference)		GetProcAddress(hinstLib, "GT_GetReference");

		hGT_SetBipolar			=(LibGT_SetBipolar)			GetProcAddress(hinstLib, "GT_SetBipolar");

		hGT_SetDRLChannel		=(LibGT_SetDRLChannel)		GetProcAddress(hinstLib, "GT_SetDRLChannel");

		hGT_EnableSC			=(LibGT_EnableSC)			GetProcAddress(hinstLib, "GT_EnableSC");
	
		hGT_SetSlave			=(LibGT_SetSlave)			GetProcAddress(hinstLib, "GT_SetSlave");

		hGT_SetDAC				=(LibGT_SetDAC)				GetProcAddress(hinstLib, "GT_SetDAC");
		hGT_SetScale			=(LibGT_SetScale)			GetProcAddress(hinstLib, "GT_SetScale");
		hGT_GetScale			=(LibGT_GetScale)			GetProcAddress(hinstLib, "GT_GetScale");
		hGT_Calibrate			=(LibGT_Calibrate)			GetProcAddress(hinstLib, "GT_Calibrate");

		hGT_GetLastError		=(LibGT_GetLastError)		GetProcAddress(hinstLib, "GT_GetLastError");

		hGT_GetDriverVersion	=(LibGT_GetDriverVersion)	GetProcAddress(hinstLib, "GT_GetDriverVersion");
		hGT_GetHWVersion		=(LibGT_GetHWVersion)		GetProcAddress(hinstLib, "GT_GetHWVersion");
		hGT_GetSerial			=(LibGT_GetSerial)			GetProcAddress(hinstLib, "GT_GetSerial");
		hGT_GetImpedance		=(LibGT_GetImpedance)		GetProcAddress(hinstLib, "GT_GetImpedance");

		
	}else
	{
		wxMessageBox(_("Can't find gUSBAmp.dll"));
	}
#endif
	connect =false;
}

ImpCheck2::~ImpCheck2(void)
{
#ifdef HAVE_GTEC_USB_LIBRARY
	if(hinstLib != NULL) 
	{
		FreeLibrary(hinstLib);
		//hinstLib = NULL;
	}
#endif
}
